# Contributor: Melven Roehrig-Zoellner <Melven.Roehrig-Zoellner@DLR.de>
# mostly copied from ../mingw-w64-python-pyqt5/PKGBUILD

_realname=pyqt5-3d
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python-${_realname}")
pkgver=5.15.4
pkgrel=4
pkgdesc="Qt5 Qt3D bindings for Python (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32')
license=('GPL')
url="https://riverbankcomputing.com/software/pyqt3d"
depends=("${MINGW_PACKAGE_PREFIX}-python-pyqt5"
         "${MINGW_PACKAGE_PREFIX}-qt5-3d"
         "${MINGW_PACKAGE_PREFIX}-qt5-gamepad")
makedepends=("${MINGW_PACKAGE_PREFIX}-cc"
             "${MINGW_PACKAGE_PREFIX}-sip"
             "${MINGW_PACKAGE_PREFIX}-pyqt-builder"
             "${MINGW_PACKAGE_PREFIX}-python-packaging")
source=(https://pypi.python.org/packages/source/P/PyQt3D/PyQt3D-${pkgver}.tar.gz)
sha256sums=('36bc56d7432ab6c59ea77e1df6f6f688d8abd6cdb340706d5cb0a9c665e13975')

build() {
  [[ -d python-${MSYSTEM} ]] && rm -rf python-${MSYSTEM}
  cp -r PyQt3D-${pkgver} python-${MSYSTEM} && cd python-${MSYSTEM}

  MSYS2_ARG_CONV_EXCL="--api-dir=;" \
  ${MINGW_PREFIX}/bin/sip-build \
    --no-make \
    --api-dir=${MINGW_PREFIX}/share/qt5/qsci/api/python \
    --qmake=${MINGW_PREFIX}/bin/qmake.exe

    cd build
    make
}

package(){
  cd python-${MSYSTEM}/build

  make DESTDIR="${pkgdir}" INSTALL_ROOT="${pkgdir}" install
}
